<template>
  <div>
    <div class="card_box">
      <h4>学校信息</h4>
      <el-row>
        <div class="grid-time">
          总人数:
          <span>{{schoolInfo.userCount}}</span>
        </div>
      </el-row>
      <el-row>
        <div class="grid-time">
          发卡数:
          <span>{{schoolInfo.cardCount}}</span>
        </div>
      </el-row>
      <el-row>
        <div class="grid-time">
          剩余卡数量:
          <span>{{schoolInfo.cardSeveral}}</span>
        </div>
      </el-row>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // 时间
      time: "",
      // 学校信息
      schoolInfo: {},
    };
  },

  created() {
    // 获取当前年月
    this.time = this.getNowTime("yy-mm-dd");
    this.getSchoolInfo();
  },
  computed: {
    changeschoolid: {
      get() {
        return this.$store.state.user.changeschoolid;
      },
    },
  },
  methods: {
    // 获取充值信息
    getSchoolInfo() {
      this.$http({
        url: this.$http.adornUrl("/info/unit/statistics"),
        method: "post",
        data: this.$http.adornData({
          messageContent: this.changeschoolid,
        }),
      }).then(({ data }) => {
        if (data.messageCode == 200) {
          console.log(data);
          this.schoolInfo = data.messageContent;
        } else {
          this.$message.error(data.errorMessage);
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.card_box {
  // padding:30px 20px;
  overflow: hidden;
  .grid-time {
    margin-top: 1vh;

    box-shadow: 0 0 10px #ddd;
    // background-color:#f5f5f5;
    height: 4vh;
    padding-left: 1vw;
    line-height: 4vh;
    border-radius: 4px;
    span {
      color: #17b3a3;
      font-size: 12px;
      margin-left: 0.6vw;
    }
  }
  h4 {
    margin: 0;
    padding-top: 0.8vh;
    padding-left: 0.8vw;
  }
  .el-row {
    padding: 1vh;
    padding-top: 0;
    font-weight: 1000;
    &:first-child {
      margin-top: 0;
    }
    .el-col {
      //   border-radius: 4px;
      border: 1px solid #ccc;
    }
  }

  .card_header {
    display: flex;
    .header_text {
      flex: 1;
      text-align: left;
    }
    .header_time {
      flex: 1;
      text-align: right;
    }
  }
}
</style>
